home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / source / amiga / HardBlocks.mod < prev    next >
Text File  |  1995-06-29  |  11KB  |  256 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: HardBlocks.mod $
  4.   Description: File system identifier blocks for hard disks
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.8 $
  8.       $Author: fjc $
  9.         $Date: 1995/06/04 23:13:14 $
  10.  
  11.   $VER: hardblocks.h 36.3 (23.8.91)
  12.   Includes Release 40.15
  13.  
  14.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  15.       All Rights Reserved
  16.  
  17.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. ***************************************************************************)
  22.  
  23. <* STANDARD- *>
  24.  
  25. MODULE [2] HardBlocks;
  26.  
  27. IMPORT e := Exec;
  28.  
  29.  
  30. (*
  31. **      File System identifier blocks for hard disks
  32. *)
  33.  
  34.  
  35. (* --------------------------------------------------------------------
  36.  *
  37.  *      This file describes blocks of data that exist on a hard disk
  38.  *      to describe that disk.  They are not generically accessable to
  39.  *      the user as they do not appear on any DOS drive.  The blocks
  40.  *      are tagged with a unique identifier, checksummed, and linked
  41.  *      together.  The root of these blocks is the RigidDiskBlock.
  42.  *
  43.  *      The RigidDiskBlock must exist on the disk within the first
  44.  *      rdbLocationLIMIT blocks.  This inhibits the use of the zero
  45.  *      cylinder in an AmigaDOS partition: although it is strictly
  46.  *      possible to store the RigidDiskBlock data in the reserved
  47.  *      area of a partition, this practice is discouraged since the
  48.  *      reserved blocks of a partition are overwritten by "Format",
  49.  *      "Install", "DiskCopy", etc.  The recommended disk layout,
  50.  *      then, is to use the first cylinder(s) to store all the drive
  51.  *      data specified by these blocks: i.e. partition descriptions,
  52.  *      file system load images, drive bad block maps, spare blocks,
  53.  *      etc.
  54.  *
  55.  *      Though only 512 byte blocks are currently supported by the
  56.  *      file system, this proposal tries to be forward-looking by
  57.  *      making the block size explicit, and by using only the first
  58.  *      256 bytes for all blocks but the LoadSeg data.
  59.  *
  60.  *------------------------------------------------------------------*)
  61.  
  62. (*
  63.  *  NOTE
  64.  *      optional block addresses below contain $ffffffff to indicate
  65.  *      a NULL address, as zero is a valid address
  66.  *)
  67.  
  68. TYPE
  69.  
  70.   RigidDiskBlockPtr * = POINTER TO RigidDiskBlock;
  71.   RigidDiskBlock * = RECORD
  72.     id *                : e.ULONG; (* 4 character identifier *)
  73.     summedLongs *       : e.ULONG; (* size of this checksummed structure *)
  74.     chkSum *            : LONGINT; (* block checksum (longword sum to zero) *)
  75.     hostID *            : e.ULONG; (* SCSI Target ID of host *)
  76.     blockBytes *        : e.ULONG; (* size of disk blocks *)
  77.     flags *             : e.ULONG; (* see below for defines *)
  78.     (* block list heads *)
  79.     badBlockList *      : e.ULONG; (* optional bad block list *)
  80.     partitionList *     : e.ULONG; (* optional first partition block *)
  81.     fileSysHeaderList * : e.ULONG; (* optional file system header block *)
  82.     driveInit *         : e.ULONG; (* optional drive-specific init code *)
  83.                                       (* DriveInit(lun,rdb,ior): "C" stk & d0/a0/a1 *)
  84.     reserved1 *         : ARRAY 6 OF e.ULONG;
  85.                                       (* set to $ffffffff *)
  86.     (* physical drive characteristics *)
  87.     cylinders *         : e.ULONG; (* number of drive cylinders *)
  88.     sectors *           : e.ULONG; (* sectors per track *)
  89.     heads *             : e.ULONG; (* number of drive heads *)
  90.     interleave *        : e.ULONG; (* interleave *)
  91.     park *              : e.ULONG; (* landing zone cylinder *)
  92.     reserved2 *         : ARRAY 3 OF e.ULONG;
  93.     writePreComp *      : e.ULONG; (* starting cylinder: write precompensation *)
  94.     reducedWrite *      : e.ULONG; (* starting cylinder: reduced write current *)
  95.     stepRate *          : e.ULONG; (* drive step rate *)
  96.     reserved3 *         : ARRAY 5 OF e.ULONG;
  97.     (* logical drive characteristics *)
  98.     rdbBlocksLo *       : e.ULONG; (* low block of range reserved for hardblocks *)
  99.     rdbBlocksHi *       : e.ULONG; (* high block of range for these hardblocks *)
  100.     loCylinder *        : e.ULONG; (* low cylinder of partitionable disk area *)
  101.     hiCylinder *        : e.ULONG; (* high cylinder of partitionable data area *)
  102.     cylBlocks *         : e.ULONG; (* number of blocks available per cylinder *)
  103.     autoParkSeconds *   : e.ULONG; (* zero for no auto park *)
  104.     highRDSKBlock *     : e.ULONG; (* highest block used by RDSK *)
  105.                                       (* (not including replacement bad blocks) *)
  106.     reserved4 *         : e.ULONG;
  107.     (* drive identification *)
  108.     diskVendor *        : ARRAY 8 OF CHAR;
  109.     diskProduct *       : ARRAY 16 OF CHAR;
  110.     diskRevision *      : ARRAY 4 OF CHAR;
  111.     controllerVendor *  : ARRAY 8 OF CHAR;
  112.     controllerProduct * : ARRAY 16 OF CHAR;
  113.     controllerRevision * : ARRAY 4 OF CHAR;
  114.     reserved5 *         : ARRAY 10 OF e.ULONG;
  115.   END; (* RigidDiskBlock *)
  116.  
  117. CONST
  118.  
  119.   idNameRigidDisk        * = 5244534BH;      (* 'RDSK' *)
  120.  
  121.   locationLimit      * = 16;
  122.  
  123.   last      * = 0;        (* no disks exist to be configured after *)
  124.                           (*   this one on this controller *)
  125.   lastLun   * = 1;        (* no LUNs exist to be configured greater *)
  126.                           (*   than this one at this SCSI Target ID *)
  127.   lastTID   * = 2;        (* no Target IDs exist to be configured *)
  128.                           (*   greater than this one on this SCSI bus *)
  129.   lsatTID   * = lastTID;  (* typo *)
  130.   noReselect * = 3;       (* don't bother trying to perform reselection *)
  131.                           (*   when talking to this drive *)
  132.   diskID    * = 4;        (* rdbDisk... identification valid *)
  133.   ctrlrID   * = 5;        (* rdbController... identification valid *)
  134.  
  135.                           (* added 7/20/89 by commodore: *)
  136.   synch     * = 6;        (* drive supports scsi synchronous mode *)
  137.                           (* CAN BE DANGEROUS TO USE IF IT DOESN'T! *)
  138.  
  139. (* ------------------------------------------------------------------*)
  140.  
  141. TYPE
  142.  
  143.   BadBlockEntryPtr * = POINTER TO BadBlockEntry;
  144.   BadBlockEntry * = RECORD
  145.     badBlock *  : e.ULONG;      (* block number of bad block *)
  146.     goodBlock * : e.ULONG;      (* block number of replacement block *)
  147.   END; (* BadBlockEntry *)
  148.  
  149.   BadBlockBlockPtr * = POINTER TO BadBlockBlock;
  150.   BadBlockBlock * = RECORD
  151.     id *          : e.ULONG; (* 4 character identifier *)
  152.     summedLongs * : e.ULONG; (* size of this checksummed structure *)
  153.     chkSum *      : LONGINT; (* block checksum (longword sum to zero) *)
  154.     hostID *      : e.ULONG; (* SCSI Target ID of host *)
  155.     next *        : e.ULONG; (* block number of the next BadBlockBlock *)
  156.     reserved *    : e.ULONG;
  157.     blockPairs *  : ARRAY 61 OF BadBlockEntry;
  158.                                 (* bad block entry pairs *)
  159.     (* note [61] assumes 512 byte blocks *)
  160.   END; (* BadBlockBlock *)
  161.  
  162. CONST
  163.  
  164.   idNameBadBlock         * = 42414442H;      (* 'BADB' *)
  165.  
  166. (* ------------------------------------------------------------------*)
  167.  
  168. TYPE
  169.  
  170.   PartitionBlockPtr * = POINTER TO PartitionBlock;
  171.   PartitionBlock * = RECORD
  172.     id *          : e.ULONG;             (* 4 character identifier *)
  173.     summedLongs * : e.ULONG;             (* size of this checksummed structure *)
  174.     chkSum *      : LONGINT;             (* block checksum (longword sum to zero) *)
  175.     hostID *      : e.ULONG;             (* SCSI Target ID of host *)
  176.     next *        : e.ULONG;             (* block number of the next PartitionBlock *)
  177.     flags *       : e.ULONG;             (* see below for defines *)
  178.     reserved1 *   : ARRAY 2 OF e.ULONG;
  179.     devFlags *    : e.ULONG;             (* preferred flags for OpenDevice *)
  180.     driveName *   : ARRAY 32 OF CHAR;    (* preferred DOS device name: BSTR form *)
  181.                                            (* (not used if this name is in use) *)
  182.     reserved2 *   : ARRAY 15 OF e.ULONG; (* filler to 32 longwords *)
  183.     environment * : ARRAY 17 OF e.ULONG; (* environment vector for this partition *)
  184.     eReserved *   : ARRAY 15 OF e.ULONG; (* reserved for future environment vector *)
  185.   END; (* PartitionBlock *)
  186.  
  187. CONST
  188.  
  189.   idNamePartition        * = 50415254H;      (* 'PART' *)
  190.  
  191.   bootable   * = 0;        (* this partition is intended to be bootable *)
  192.                            (*   (expected directories and files exist) *)
  193.   noMount    * = 1;        (* do not mount this partition (e.g. manually *)
  194.                            (*   mounted, but space reserved here) *)
  195.  
  196. (* ------------------------------------------------------------------*)
  197.  
  198. TYPE
  199.  
  200.   FileSysHeaderBlockPtr * = POINTER TO FileSysHeaderBlock;
  201.   FileSysHeaderBlock * = RECORD
  202.     id *          : e.ULONG; (* 4 character identifier *)
  203.     summedLongs * : e.ULONG; (* size of this checksummed structure *)
  204.     chkSum *      : LONGINT; (* block checksum (longword sum to zero) *)
  205.     hostID *      : e.ULONG; (* SCSI Target ID of host *)
  206.     next *        : e.ULONG; (* block number of next FileSysHeaderBlock *)
  207.     flags *       : e.ULONG; (* see below for defines *)
  208.     reserved1 *   : ARRAY 2 OF e.ULONG;
  209.     dosType *     : e.ULONG; (* file system description: match this with *)
  210.                                 (* partition environment's deDOSTYPE entry *)
  211.     version *     : e.ULONG; (* release version of this code *)
  212.     patchFlags *  : e.ULONG; (* bits set for those of the following that *)
  213.                                 (*   need to be substituted into a standard *)
  214.                                 (*   device node for this file system: e.g. *)
  215.                                 (*   180H to substitute SegList & GlobalVec *)
  216.     type *        : e.ULONG; (* device node type: zero *)
  217.     task *        : e.ULONG; (* standard dos "task" field: zero *)
  218.     lock *        : e.ULONG; (* not used for devices: zero *)
  219.     handler *     : e.ULONG; (* filename to loadseg: zero placeholder *)
  220.     stackSize *   : e.ULONG; (* stacksize to use when starting task *)
  221.     priority *    : LONGINT; (* task priority when starting task *)
  222.     startup *     : LONGINT; (* startup msg: zero placeholder *)
  223.     segListBlocks * : LONGINT; (* first of linked list of LoadSegBlocks: *)
  224.                                   (*   note that this entry requires some *)
  225.                                   (*   processing before substitution *)
  226.     globalVec *   : LONGINT; (* BCPL global vector when starting task *)
  227.     reserved2 *   : ARRAY 23 OF e.ULONG; (* (those reserved by PatchFlags) *)
  228.     reserved3 *   : ARRAY 21 OF e.ULONG;
  229.   END; (* FileSysHeaderBlock *)
  230.  
  231. CONST
  232.  
  233.   idNameFileSysHeader    * = 46534844H;      (* 'FSHD' *)
  234.  
  235. (* ------------------------------------------------------------------*)
  236.  
  237. TYPE
  238.  
  239.   LoadSegBlockPtr * = POINTER TO LoadSegBlock;
  240.   LoadSegBlock * = RECORD
  241.     id *          : e.ULONG; (* 4 character identifier *)
  242.     summedLongs * : e.ULONG; (* size of this checksummed structure *)
  243.     chkSum *      : LONGINT; (* block checksum (longword sum to zero) *)
  244.     hostID *      : e.ULONG; (* Target ID of host *)
  245.     next *        : e.ULONG; (* block number of the next LoadSegBlock *)
  246.     loadData *    : ARRAY 123 OF e.ULONG;  (* data for "loadseg" *)
  247.     (* note [123] assumes 512 byte blocks *)
  248.   END; (* LoadSegBlock *)
  249.  
  250. CONST
  251.  
  252.   idNameLoadSeg          * = 4C534547H;      (* 'LSEG' *)
  253.  
  254.  
  255. END HardBlocks.
  256.